package com.wendu.oa.service.info.impl;

import com.wendu.oa.dao.info.DepDao;
import com.wendu.oa.model.Deparment;
import com.wendu.oa.service.info.DepService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Service
@Transactional
@CacheConfig(cacheNames = "service.info.dep")
public class DepServiceImpl implements DepService {

    @Resource
    private DepDao depDao;

    @Cacheable(key = "targetClass +'.'+ methodName+'()'")
    @Override
    public List<Deparment> getDepList() {
        return depDao.findAllDepList();
    }
}
